

/*
    views utility
*/



#include <stdint.h>
/*
    views utility
*/

#include "views.h"
#include "views_util.h"

uint16_t share_text[20]={0};

uint32_t m_flag_of_view_share = 0;


typedef struct
{
    int32_t cur;
    int32_t min;
    int32_t max;
}view_fsm_t;

static view_fsm_t m_view_fsm;

void views_util_fsm_init(int32_t min, int32_t max, int32_t cur)
{
    m_view_fsm.min = min;
    m_view_fsm.max = max;
    m_view_fsm.cur = cur;
}

int32_t views_util_fsm_get(void)
{
    return m_view_fsm.cur;
}

void views_util_fsm_set(int32_t val)
{
    m_view_fsm.cur = val;
}

void views_util_fsm_reset(void)
{
    m_view_fsm.cur = m_view_fsm.min;
}

void views_util_fsm_toggle(void)
{
    m_view_fsm.cur = !m_view_fsm.cur;
}

void views_util_fsm_inc(void)
{
    m_view_fsm.cur ++;
    if( m_view_fsm.cur > m_view_fsm.max )
    {
        m_view_fsm.cur = m_view_fsm.min;
    }
}
void views_util_fsm_dec(void)
{
    if( m_view_fsm.cur > m_view_fsm.min )
    {
        m_view_fsm.cur --;
    }
    else 
    {
        m_view_fsm.cur = m_view_fsm.max;
    }
}


views_util_value_t m_views_util_values;

void views_util_set_axis_x(int16_t x)
{
    m_views_util_values.x = x;
}
void views_util_set_axis_y(int16_t y)
{
    m_views_util_values.y = y;
}


